package com.magic.gre.mvp.presenter;

import android.renderscript.BaseObj;

import com.google.gson.reflect.TypeToken;
import com.magic.gre.entity.base.BaseObjectModel;
import com.magic.gre.mvp.contract.SuggestionContract;
import com.magic.gre.mvp.model.SuggestionModelImpl;
import com.noname.lib_base_java.mvp.BasePresenterImpl;

/**
 * Author: Lmoumou
 * Date: 2019-01-10 21:04
 * 文件名: SuggestionPresenterImpl
 * 描述:
 */
public class SuggestionPresenterImpl extends BasePresenterImpl<SuggestionContract.View, SuggestionContract.Model>
        implements SuggestionContract.Presenter {
    public SuggestionPresenterImpl(SuggestionContract.View view) {
        super(view);
    }

    @Override
    protected SuggestionContract.Model creatModel() {
        return new SuggestionModelImpl();
    }

    @Override
    public void pFeedBack(String content, String contact) {
        mModel.mFeedBack(new CommonObserver<BaseObjectModel>(new TypeToken<BaseObjectModel>(){}.getType()) {
            @Override
            protected void onSuccess(BaseObjectModel baseObjectModel) {
                mView.vFeedBack();
            }

            @Override
            public void onError(int status, String msg) {
                mView.doPrompt(msg);
            }
        }, content, contact);
    }
}
